##############################
#   Basic    
#   by Jerry Yang      
#   UUZ0218            
#############################
from random import randrange
from character import Character
import time

def pro(inf):
    L = randrange(1,99)
    M = randrange(50,99)
    D = randrange(1,50)
    A = randrange(10,99)
    inf['Attack'] = A
    inf['Defend'] = D
    inf['Magic'] = M
    inf['Lucky'] = L
    return(inf)

def welcome_initial():
    print('The Unlimited Adventure')
    time.sleep(2)
    print('author:子迁')
    time.sleep(2)
    
def welcome():
    welcome_initial()
    inf = {}
    Skill = {}
    name = input('Please input your name, adventurer:')
    inf["Adventurer's Name"] = name
    print('Welcome to The Unlimited Adventure, '+name+'! Here is your information')
    time.sleep(1)
    flag = True
    while flag:
        inf = pro(inf)
        get_information(inf)
        R_A = input('Random again?YorN:')
        if R_A == 'Y' or R_A == 'y':
            continue
        elif R_A == 'N' or R_A == 'n':
            flag = False
            break
    inf['Level'] = 1
    inf['Exp'] = 0
    Skill['二连击'] = {
            'SkillMagic':10,
            'SkillAttack':inf['Attack']*2,
    }
    inf = Character.exp(inf)
    inf = Character.blood(inf)
    return(inf,Skill)

def get_information(inf):
    for name,info in inf.items():
        print(name + ' : ' + str(info))
        time.sleep(0.5)
    print('\n')
    time.sleep(1)
    

